<template>
	<view style="padding-bottom: 150rpx;">
		<view class="mainpadding">
			<!--数据统计  -->
			<view class="sjbox radius">
				<view class="ershiba xiaobai fonweight">数据统计</view>
				<view class="flexbetween margin_top5">
					<view class="flexcenter sanshis" @click="jumper('/pages_xiaoshou/kehuguanli')">
						<view class="">
							<view class="bigtext xiaobai fonweight flexcenter">{{dataAll.fzkh_num}}</view>
							<view class="flexright margin_top1">
								<view class="strongtext xiaobai nofonweight">发展客户</view>
								<u-icon name="arrow-right" color="#FFFFFF" size="12"></u-icon>
							</view>
						</view>
					</view>
					<view class="flexcenter sanshis" @click="jumper('/pages_xiaoshou/dingdan')">
						<view class="">
							<view class="bigtext xiaobai fonweight flexcenter">{{dataAll.order_num}}</view>
							<view class="flexright margin_top1">
								<view class="strongtext xiaobai nofonweight">订单数量</view>
								<u-icon name="arrow-right" color="#FFFFFF" size="12"></u-icon>
							</view>
						</view>
					</view>
					<view class="flexcenter sanshis">
						<view class="">
							<view class="bigtext xiaobai fonweight flexcenter">{{dataAll.order_price}}</view>
							<view class="flexright margin_top1">
								<view class="strongtext xiaobai nofonweight">交易总金额</view>
								<!-- <u-icon name="arrow-right" color="#FFFFFF" size="12"></u-icon> -->
							</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 推广 -->
			<view class="tuigtp margin_top" @click="tuiguang">
				<image src="../static/image/system/yqtg.png" mode=""></image>
			</view>
			<!-- 课程管理 -->
			<view class="margin_top">
				<view class="bigtext xiaohei nofonweight">课程管理</view>
				<view class="flexcenter" v-if="!list.data.length">
					<view class="placeholderimage" style="margin-top: 200rpx;" ></view>
				</view>
				<view class="ffffff mainpadding radius flexbetween margin_top" v-for="item in list.data" :key="item.id" @click="tzkcxq(item.id)">
					<view class="">
						<view class="titletext xiaohei nofonweight">{{item.name}}
							<text class="smalltext xiaohei nofonweight">（{{item.userzbfapply.name}}）</text>
						</view>
						<view class="xiaohui strongtext nofonweight margin_top2">学生数量：
							<text class="xiaolv strongtext nofonweight">{{item.user_num}}人</text>
						</view>
					</view>
					<u-icon name="arrow-right" color="#888888" size="12"></u-icon>
				</view>
			</view>
		</view>
		<!-- <view class="ffffff mainpadding ">
			<view class="bigtext xiaohei nofonweight xiabb kuandu">明细</view>
			<view class="flexbetween margin_top" v-for="item in 2">
				<view class="">
					<view class="titletext xiaohei nofonweight">游泳课程</view>
					<view class="strongtext xiaohui nofonweight margin_top1">下单人账号：123456</view>
				</view>
				<view class="">
					<view class="titletext xiaohei fonweight textright">+¥1000</view>
					<view class="strongtext xiaohui nofonweight margin_top1">2020-02-02 20:20:20</view>
				</view>
			</view>
		</view> -->
		<tabbarxsd current=0></tabbarxsd>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				dataAll: {},
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onLoad(options) {
			uni.hideTabBar()
			
			
		},
		onShow() {
			this.index()
			this.init()
		},
		methods: {
			tuiguang(){
				uni.navigateTo({
					url:"/pages_xiaoshou/yaoqinghy"
				})
			},
			index() {
				httpRequest.request('/api/user/xsDataIndex', 'GET', {}).then(res => {
					this.dataAll = res.data
				})
			},
			init(isPage, page) {
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit
				}
				let url = '/api/user/xsKcDta'
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
						this.$forceUpdate()
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			// 跳转课程详情
			tzkcxq(id) {
				uni.navigateTo({
					url: '/pages_xiaoshou/kechengxq?id='+id
				})
			},
			jumper(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.kuandu {
		width: 72rpx;
	}

	.xiabb {
		border-bottom: 4rpx solid #1BA95B;
	}

	.tuigtp {
		width: 100%;
		height: 132rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.sjbox {
		padding: 40rpx 24rpx;
		background-color: #18C451;
	}

	page {
		background: #F5F5F5;
	}
</style>